package com.pzhu.common.exception;


import com.pzhu.model.help.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 全局异常处理
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = RuntimeException.class)
    public ResponseResult handler(RuntimeException e){
        log.error("运行时异常：----------------{}", e.getMessage());
        return ResponseResult.error(e.getMessage());
    }
}
